<?php

//<editor-fold defaultstate="collapsed" desc="License & Copyright">
/*
 * @license
 */

/**
 *
 * @author Jevgeni Geimanen (jevgeni.geimanen@gmail.com)
 */
//</editor-fold>
class SCForm extends Container {
    const EVENT_SUBMIT = 'submit';
    
    /**
     * @smarty field
     * @return FormFieldCollection 
     */
    public function getChildControls() {
        if ($this->_ChildControls === null) {
            if (sCore::ClassExists($className = get_class($this)."_FieldCollection")) {
                $this->_ChildControls = new $className();
            } else {
                $this->_ChildControls = new FormFieldCollection();
            }
        }
        return parent::getChildControls();
    }
    
    /**
     *
     * @return FormFieldCollection
     */
    public function getFields() {
        return $this->getChildControls();
    }
    
    
    
    //<editor-fold defaultstate="collapsed" desc="Event Shortcuts">
    /**
     *
     * @param object $object
     * @param string $eventName
     * @return Form
     */
    public function addSubmitEventListener($object,$eventName) {
        return $this->addEventListener(Form::EVENT_SUBMIT, $object, $eventName);
    }
    //</editor-fold>
}

?>
